<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="favicon.ico"> 
	<link href="__PUBLIC__/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/animate.css" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/style.css?v=4.1.0" rel="stylesheet">
</head>
<script>
var url = "{:url('version/lst')}";
var updateUrl = "{:url('version/edit')}";
</script>

<body class="gray-bg">
<style>
input.error{
	border:1px solid red;
}
span.error{
	padding-top:10px;
	color: #f00;
	font-size:12px;
}
</style>
<div class="wrapper wrapper-content">

    <div class="row">

        <div class="col-sm-12">

            <div class="ibox float-e-margins">

                <div class="ibox-title">

                    <h5>增加版本</h5>

                </div>

                <div class="ibox-content">

                    <form method="post" class="form-horizontal" id="form">

                        <div class="form-group">

                            <label class="col-sm-2 control-label">版本名称</label>

                            <div class="col-sm-6">

                                <input type="text" name="version_name" value="{$version.version_name}" class="form-control">

                            </div>

                        </div>

                        <div class="hr-line-dashed"></div>



                        <div class="form-group">

                            <label class="col-sm-2 control-label">版本号</label>

                            <div class="col-sm-6">

                                <input type="text" name="version_code" value="{$version.version_code}" class="form-control">

                            </div>

                        </div>

                        <div class="hr-line-dashed"></div>



                        <div class="form-group">

                            <label class="col-sm-2 control-label">更新内容：</label>

                            <div class="col-sm-6">

                                <input type="text" name="version_info" value="{$version.version_info}" class="form-control">

                            </div>

                        </div>

                        <div class="hr-line-dashed"></div>

                        <div class="form-group">

                            <label class="col-sm-2 control-label">更新方式：</label>

                            <div class="col-sm-6">
                                <label class="radio-inline">
                                    <input type="radio" name="update_type" value="forcibly" {if condition="$version.update_type eq 'forcibly'"} checked="checked" {/if}>强制更新</label>
                                <label class="radio-inline">
                                    <input type="radio" name="update_type" value="solicit"  {if condition="$version.update_type eq 'solicit'"} checked="checked" {/if}>弹窗确认更新</label>
                                <label class="radio-inline">
                                    <input type="radio" name="update_type" value="silent" {if condition="$version.update_type eq 'silent'"} checked="checked" {/if} >静默更新</label>

                            </div>

                        </div>

                        <div class="hr-line-dashed"></div>





                        <!--<div class="form-group">-->

                        <!--<label class="col-sm-2 control-label">上传Android：</label>-->

                        <!--<div class="col-sm-6">-->

                        <!--<input type="file" name="filedate" class="form-control">-->

                        <!--</div>-->

                        <!--</div>-->

                        <!--<div class="hr-line-dashed"></div>-->





                        <!--                            <div class="form-group">-->

                        <!--                                <label  class="col-sm-2 control-label">上传android包:</label>-->

                        <!--                                <div class="col-sm-6">-->

                        <!--                                    <div style="margin-bottom:7px; margin-top:5px;">-->

                        <!--                                        <img id="imageinfo" src="__PUBLIC__/admin/img/nopic.jpg" width="120" height="120" border="0" />-->

                        <!--                                        <br/><button type="button" class="btn btn-danger btn-xs del" style="display:none;">删除</button>-->

                        <!--                                    </div>-->

                        <!--                                    <div id="uploaderInput"></div>-->

                        <!--                                    <input type="hidden" name="urls" value="" >-->

                        <!--                                </div>-->

                        <!--                            </div>-->
                        <div class="form-group">
                            <label class="col-sm-2 control-label">安卓下载地址:</label>
                            <div class="col-sm-6">
                                <input type="text" name="android_url" class="form-control" value="{$version.android_url}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">IOS下载地址:</label>
                            <div class="col-sm-6">
                                <input type="text" name="ios_url" class="form-control" value="{$version.ios_url}">
                            </div>
                        </div>

                        <input type="hidden" name="id" value="{$version.id}">
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">

                            <div class="col-sm-4 col-sm-offset-2">


                                <button class="btn btn-primary" type="submit" id="doSubmit" style="margin-right:100px;">保存内容</button>

                                <button type="reset" class="btn btn-default">重置</button>

                            </div>

                        </div>

                    </form>

                </div>

            </div>

        </div>

    </div>

</div>


<!-- 全局js -->
    <script src="__PUBLIC__/admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="__PUBLIC__/admin/js/bootstrap.min.js?v=3.3.6"></script>
    <!-- 自定义js -->
    <script src="__PUBLIC__/admin/js/plugins/layer/layer.min.js"></script>
    <script src="__PUBLIC__/admin/js/plugins/validate/jquery.validate.min.js"></script>	
    <script src="__PUBLIC__/admin/js/content.js?v=1.0.0"></script>
    <!-- iCheck -->
    <script src="__PUBLIC__/admin/js/plugins/iCheck/icheck.min.js"></script>
    <script src="__PUBLIC__/admin/js/common/ajax.js"></script>

	 <script>	
    	$(function(){    		
            $('.i-checks').iCheck({
                checkboxClass: 'icheckbox_square-green',
                radioClass: 'iradio_square-green',
            });

    	    var icon = "<i class='fa fa-times-circle'></i>&nbsp;&nbsp;";
        	$('#form').validate({
	            errorElement : 'span',
	        	debug: true,//只验证不提交表单
	            //layer ajax提交表单
	            submitHandler:function(){
	               // 序列化 表单数据 后提交 ，太简洁了
	            	post(updateUrl,'POST',$('#form').serialize(),1);
	                // return false;
	            },//这是关键的语句，配置这个参数后表单不会自动提交，验证通过之后会去调用的方法

	            rules:{
                    version_name:{required:true},
                    version_code:{required:true}
	        	},

	        	messages:{
                    version_name:{required:icon+'必填'},
                    version_code:{required:icon+'必填'}
	        	}
            });
      }); 

      function cl(){
    	  parent.location.href = url;
      }
    </script>

</body>
</html>